-
Notifications
You must be signed in to change notification settings - Fork 117
Add new KeySpacePath.exportAllData #3566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new KeySpacePath.exportAllData #3566
Conversation
This will be returned by export
Most of the time this will be used with remainders, so make most of the tests cover that
| import javax.annotation.Nonnull; | ||
| import java.util.UUID; | ||
|
|
||
| /** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you're reviewing this top-to-bottom, this class was extracted from KeySpaceDirectoryTest, but setupSampleData was added.
...main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathImpl.java
Show resolved
Hide resolved
...in/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
Outdated
Show resolved
Hide resolved
...in/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
Outdated
Show resolved
Hide resolved
...in/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
Outdated
Show resolved
Hide resolved
...ava/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePathTest.java
Outdated
Show resolved
Hide resolved
...ava/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePathTest.java
Outdated
Show resolved
Hide resolved
...in/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
Show resolved
Hide resolved
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathDataExportTest.java
Outdated
Show resolved
Hide resolved
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathDataExportTest.java
Outdated
Show resolved
Hide resolved
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathDataExportTest.java
Outdated
Show resolved
Hide resolved
ScottDugas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through a bunch of the comments, and responded. I've made a bunch of the changes locally, but when I got to implementing DataInKeySpacePath.equals/hashCode, I discovered that ResolvedKeySpacePath does not implement those correctly. I'm going to pause, the work on this PR, to resolve that. I'm submitting my commits in the meantime, for visibility.
...main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathImpl.java
Show resolved
Hide resolved
...in/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
Show resolved
Hide resolved
...in/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
Outdated
Show resolved
Hide resolved
...src/main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePath.java
Outdated
Show resolved
Hide resolved
...in/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
Outdated
Show resolved
Hide resolved
...ava/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePathTest.java
Outdated
Show resolved
Hide resolved
...ava/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePathTest.java
Show resolved
Hide resolved
...ava/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePathTest.java
Outdated
Show resolved
Hide resolved
...ava/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePathTest.java
Outdated
Show resolved
Hide resolved
...in/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DataInKeySpacePath.java
Show resolved
Hide resolved
I left a TODO for myself to add unit tests of withRemainder...
I updated the tests to not use KeyValue directly, at which point, having DataInKeySpacePath expose the value and not the raw KeyValue seemed to make sense
This isn't the greatest test, but I think the proper test would be to explicitly list the non-default methods and then use reflection and error if any new methods are added and don't have a default implementation.
...src/main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePath.java
Outdated
Show resolved
Hide resolved
...src/main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePath.java
Show resolved
Hide resolved
...src/main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePath.java
Show resolved
Hide resolved
.../java/com/apple/foundationdb/record/provider/foundationdb/keyspace/ResolvedKeySpacePath.java
Outdated
Show resolved
Hide resolved
| keySpace.root().getValue(), keySpace.root(), context)); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a test that fails to resolve a key?
Would it make sense to add test for resolve with NULL value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test that fails to resolve (has a different root)
Regarding NULL, are you suggesting creating a DataInKeySpacePath with KeyValue(key, null), or a path that has a NULL type in it?
For the former, I don't think FDB will ever return such a KeyValue, and if you have one, you would never be able to insert it, because set does not allow a null value. Give that, it probably makes sense to have DataInKeySpacePath error if it gets a null value.
For the later, I think that should be better tested in KeySpacePath.toResolvedPathAsync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the later - NULL type.
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathDataExportTest.java
Show resolved
Hide resolved
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathDataExportTest.java
Show resolved
Hide resolved
Predominately: - DataInKeySpace now errors if it gets a null value - Improved javadoc linking KeySpace.resolveFromKeyAsync and KeySpacePath.toResolvedPathAsync - Fix error message in default method - Reduce visibility of ResolvedKeySPacePath.withRemainder - new negative tests in DataInKeySpacePathTest - Better coverage of exporting with mixed-type sub-directories
This introduces a new KeySpacePath.exportAllData to export all the data stored in the path. This can eventually be used to import into another cluster, or back into the same cluster, after clearing.
Other than the path information, the data exported is raw bytes, with no transformation or indicated semantics.
Resolves: 3572